program NumberPi;

{$APPTYPE CONSOLE}
var
x, y, p : double;
q, k : longint;
i, num, step : integer;
fout : textfile;
begin

assignfile(fout, 'output.txt');
rewrite(fout);

q := 1;
step := 10;
for i:=1 to 8 do
begin
  q := q*step;
end;

k := 1;
for i := 1 to 3 do
begin
  k := k*step;
end;

for i := 1 to q do
begin
  x := 2*random;
  y := 2*random;
  if (x-1)*(x-1)+(y-1)*(y-1)<=1 then num := num+1;
  p := (num/i)*4;
  p := abs(pi-p);
  if (i mod k) = 0 then writeln(fout, p:0:5,' ', i);
end;
close(fout);
readln;
end.
 